;(function (modules) {
	function require(id) {
		const [fn, mapping] = modules[id]
		const module = {
			exports: {},
		}
		function localRequire(path) {
			const id = mapping[path]
			return require(id)
		}
		fn({ require: localRequire, module, exports: module.exports })
		return module.exports
	}
	require(1)
})({
	1: [
		// main.js
		function ({ require }) {
			const { add } = require('./add.js')
			console.log('add :>>', add(1, 2))
		},
		{ './add.js': 2 },
	],
	2: [
		function ({ module }) {
			function add(a, b) {
				return a + b
			}
			module.exports = {
				add,
			}
		},
		{},
	],
})
